package com.lenovo.vod.player.setting.util;

import java.io.IOException;
import java.io.InputStream;

import org.xmlpull.v1.XmlPullParser;
import org.xmlpull.v1.XmlPullParserException;

import android.util.Xml;

public class XmlParser {

	public static String doParserXml(InputStream in) throws XmlPullParserException, IOException{
		XmlPullParser mXmlPullParser = Xml.newPullParser();
		String mResultCode = null ;
			mXmlPullParser.setInput(in, "utf-8");
			int eventType = mXmlPullParser.getEventType();
			while(eventType != XmlPullParser.END_DOCUMENT){
				switch(eventType){
					case XmlPullParser.START_TAG:
						String eleName = mXmlPullParser.getName();
						if("errorMessage".equals(eleName)){
							mResultCode = mXmlPullParser.nextText();
						}
						break;
				}
				eventType = mXmlPullParser.next();
			}
		return mResultCode;
	}
}
